-
Notifications
You must be signed in to change notification settings - Fork 233
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
adds support for OpenAPI 3.1 descriptions #5936
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Vincent Biret <[email protected]>
Signed-off-by: Vincent Biret <[email protected]>
Signed-off-by: Vincent Biret <[email protected]>
Signed-off-by: Vincent Biret <[email protected]>
Signed-off-by: Vincent Biret <[email protected]>
Signed-off-by: Vincent Biret <[email protected]>
Signed-off-by: Vincent Biret <[email protected]>
Signed-off-by: Vincent Biret <[email protected]>
Signed-off-by: Vincent Biret <[email protected]>
Signed-off-by: Vincent Biret <[email protected]>
Signed-off-by: Vincent Biret <[email protected]>
Signed-off-by: Vincent Biret <[email protected]>
Signed-off-by: Vincent Biret <[email protected]>
Signed-off-by: Vincent Biret <[email protected]>
Signed-off-by: Vincent Biret <[email protected]>
Signed-off-by: Vincent Biret <[email protected]>
Signed-off-by: Vincent Biret <[email protected]>
Signed-off-by: Vincent Biret <[email protected]>
Signed-off-by: Vincent Biret <[email protected]>
Signed-off-by: Vincent Biret <[email protected]>
Signed-off-by: Vincent Biret <[email protected]>
fix: missing descriptions Signed-off-by: Vincent Biret <[email protected]>
Signed-off-by: Vincent Biret <[email protected]>
Signed-off-by: Vincent Biret <[email protected]>
Signed-off-by: Vincent Biret <[email protected]>
and the unit tests are impacted by this bug microsoft/OpenAPI.NET#2150 |
Signed-off-by: Vincent Biret <[email protected]>
Signed-off-by: Vincent Biret <[email protected]>
Signed-off-by: Vincent Biret <[email protected]>
Signed-off-by: Vincent Biret <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍🏼
for anybody following along, we'll need to wait for the release of this fix. |
@@ -19,7 +20,7 @@ internal static void InitializeInheritanceIndex(this OpenApiDocument openApiDocu | |||
{ | |||
inheritanceIndex.TryAdd(entry.Key, new(StringComparer.OrdinalIgnoreCase)); | |||
if (entry.Value.AllOf != null) | |||
foreach (var allOfEntry in entry.Value.AllOf.Where(static x => !string.IsNullOrEmpty(x.Reference?.Id))) | |||
foreach (var allOfEntry in entry.Value.AllOf.OfType<OpenApiSchemaReference>()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In case the Id could be null?
foreach (var allOfEntry in entry.Value.AllOf.OfType<OpenApiSchemaReference>()) | |
foreach (var allOfEntry in entry.Value.AllOf.Where(static x => x is OpenApiSchemaReference xRef && !string.IsNullOrEmpty(x.Reference?.Id)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe we need to maintain the OfType for the rest of the code.
So I'm going to reply with this suggestion
foreach (var allOfEntry in entry.Value.AllOf.OfType<OpenApiSchemaReference>()) | |
foreach (var allOfEntry in entry.Value.AllOf.OfType<OpenApiSchemaReference>().Where(static x => x !string.IsNullOrEmpty(x.Reference?.Id)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok. Using a single where should offer more efficient codegen, but I don't have a strong opinion here.
Benchmark results:
Method | Mean | Error | StdDev | Allocated |
---|---|---|---|---|
RunOfTypeWhere | 26.43 us | 0.258 us | 0.241 us | 144 B |
RunWhere | 14.03 us | 0.158 us | 0.140 us | 72 B |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what I meant is that line 25 we'll need to cast anyway.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's ok. There's an extra allocation when using OfType each time this region of code is run, but it shouldn't affect much assuming this isn't a hot path. Simply casting shouldn't incur the cost of that allocation
Signed-off-by: Vincent Biret <[email protected]>
Signed-off-by: Vincent Biret <[email protected]>
Signed-off-by: Vincent Biret <[email protected]>
@andrueastman @calebkiage this is ready for final review and merge 🚀🚀🚀🚀🚀🚀 |
|
fixes #3914
depends on microsoft/OpenAPI.NET#2023
In addition to "supporting the new format" this PR does a couple of things:
["number", "string"]
) and projects them as union types.